package atom.core0.app.thread.pool;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class MyThreadPoolExecutor extends ThreadPoolExecutor
{
	private static MyPoolThreadFactory threadFactory = new MyPoolThreadFactory();

	public MyThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit,
	        BlockingQueue<Runnable> workQueue) 
	{
		super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory,new ThreadPoolExecutor.CallerRunsPolicy());
	}
	public MyThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit,
	        BlockingQueue<Runnable> workQueue,RejectedExecutionHandler handler) 
	{
		super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory,handler);
	}	
	public MyThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit,
	        BlockingQueue<Runnable> workQueue,String threadDesc) 
	{
		super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory,new ThreadPoolExecutor.CallerRunsPolicy());
		threadFactory.setNamePrefix(threadDesc);
	}

}
